export function loadBMap() {
  return new Promise(function (resolve, reject) {
    if (typeof Bmap !== 'undefined') {
      //eslint-disable-next-line
      resolve(BMap)
      return true
    }
    window.onBMapCallback = function () {
      //eslint-disable-next-line
      resolve(BMap)
    }
    let script = document.createElement('script')
    script.type = 'text/javascript'
    script.src = 'https://api.map.baidu.com/api?v=2.0&ak=0BZNeQkagB8bHpCItPx8XjNU2K344Sl6&callback=onBMapCallback'
    script.onerror = reject
    document.body.appendChild(script)
  })
}
